<template>
	<view>
		<z-paging ref="paging" v-model="dataList" @query="queryList" :auto="false" safe-area-inset-bottom>
			<view class="tab" slot="top">
				<u-tabs :list="tabList" :activeStyle="activeStyle" lineHeight="0" :inactiveStyle="inactiveStyle"
					:scrollable="false" @click="tabChange" :current="current"></u-tabs>
			</view>
			<view class="content">
				<view class="evaluate_item" v-for="(item,index) in dataList" :key="index">
					<u-avatar :src="item.avatar" size="43"></u-avatar>
					<view class="item_right">
						<view class="item_title  m-bottom-5">
							<u--text :text="item.username" color="#141414" size="15"></u--text>
							<u--text :text="item.createtime" color="#989898" size="13" align="right"></u--text>
						</view>
						<u-rate :count="5" v-model="item.star" readonly active-color="#FFC100"></u-rate>
						<u--text :text="item.content" color="#141414" size="15" margin="15px 0px 0px" lineHeight="22"></u--text>
						<view class="evaluate_image" v-if="item.images.length>0">
							<image v-for="(e,eIndex) in item.images" :key="eIndex" :src="e" mode="aspectFill" ></image>
						</view>
						<!-- <view class="like">
							<u-icon :name="item.status==1?'thumb-up-fill':'thumb-up'" size="20" :label="item.likeNum"
								:color="item.status==1?'#FFC100':'#1C1C1C'"></u-icon>
						</view> -->
					</view>
				</view>
			</view>

		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				tabList: [{
						name: "全部",
						type: 0
					},
					{
						name: "最新",
						type: 1
					},
					{
						name: "有图",
						type: 2
					},
					{
						name: "无图",
						type: 3
					}
				],
				current: 0,
				inactiveStyle: {
					padding: "15rpx 40rpx",
					color: "#656565",
					fontSize: "15px",
					background: "#F8F8F8",
					borderRadius: "40rpx"
				},
				activeStyle: {
					background: "#fff8e2",
					color: "#FF9F04",
					padding: "15rpx 40rpx",
					fontSize: "15px",
					borderRadius: "40rpx"
				},
				shop_id:0
			};
		},
		onLoad(e) {
			this.shop_id=e.id
			this.$refs.paging.reload()
		},
		methods: {
			tabChange(e) {
				this.current = e.index
				this.$refs.paging.reload()
			},
			queryList(pageNo, pageSize) {
				this.$http.post('wanlshop/user/comment', {
					type: this.tabList[this.current].type,
					page: pageNo,
					limit: pageSize,
					shop_id:this.shop_id
				}).then(res => {
					if(res.code==1){
						this.$refs.paging.complete(res.data.data);
					}else{
						this.$refs.paging.complete(false);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 30rpx;
	}

	.tab {
		padding: 20rpx 0;
	}

	.evaluate_item {
		display: grid;
		grid-template-columns: 43px auto;
		grid-column-gap: 20rpx;
		margin-bottom: 20rpx;

		.item_right {
			padding-bottom: 20rpx;
			border-bottom: 2rpx solid #EEEEEE;

			.item_title {
				display: flex;
				justify-content: space-between;
				padding-left: 10rpx;
			}

			.evaluate_image {
				display: grid;
				grid-template-columns: 1fr 1fr 1fr;
				grid-column-gap: 20rpx;
				grid-row-gap: 20rpx;
				image{
					width: 100%;
					height: 186rpx;
					border-radius: 20rpx;
				}
			}
		}
	}

	.like {
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}

	.evaluate_item:last-child {
		margin-bottom: 0;
	}
</style>
